<?
class Register_model extends CI_Model {
	
	public function __construct()
	{
		$this->load->database();
		$this->load->helper('string');
	}
	
	public function set_register() {
		//县、市、自治县POST值的特殊处理
		$_POST['dist'] = ($this->input->post('dist')=="default") ? "" : $this->input->post('dist');
		
		$data  = array(
			'station' => $this->input->post('station'),
			'administrative' => $this->input->post('prov')." ".
							   $this->input->post('city')." ".
							   $this->input->post('dist'),
			'address_detail' => $this->input->post('address'),
			'contact' => $this->input->post('contact'),
			'telephone' => $this->input->post('telephone'),
			//'token' => random_string('alnum', 8)
		);

		// trim all the $data vals
		$data = array_map('trim', $data);
		return $this->db->insert('vineyards', $data);
	}
	
	public function get_register() {
		
	}
}
?>